﻿@page
@model FastEtlWeb.Pages.DataModel
<section class="content-header" style="padding:5px 5px 5px 20px;color:blue;">数据源</section>
<section class="content">
    <form class="form-inline" id="DataForm" style="margin-top:-10px;">
        <button type="button" class="btn btn-primary btn-sm" id="AddBtn">增加</button>
    </form>
    <div id="DataContent" style="margin-top:-8px;"></div>
</section>
<script>
    $(function () {
        $.QueryList("data?handler=dataList", "DataForm", "DataContent", "DataTable");
    });

    $("#AddBtn").click(function () {
        layer.open({
            type: 2,
            area: ['500px', '500px'],
            fixed: false,
            content: "DataForm",
            title: "增加数据源",
            end: function () {
                $.QueryList("data?handler=dataList", "DataForm", "DataContent", "DataTable");
            }
        });
    });

    function FnEdit(id) {
        layer.open({
            type: 2,
            area: ['500px', '500px'],
            fixed: false,
            content: "DataForm?id="+id,
            title: "编辑数据源",
            end: function () {
                $.QueryList("data?handler=dataList", "DataForm", "DataContent", "DataTable");
            }
        });
    }

    function FnDel(id) {
        var index = layer.confirm("是否删除数据源", {
            btn: ['是', '否']
        }, function () {
            layer.close(index);
            $.ajax({
                type: "post",
                url: "Data?handler=Del",
                data: { "id": id },
                success: function (result) {
                    layer.closeAll('loading');
                    layer.msg(result.msg);
                    if (result.success)
                        $.QueryList("data?handler=dataList", "DataForm", "DataContent", "DataTable");
                }
            });
        }, function () { });
    }
</script>